﻿@model CID.Domain.Audit.ReleaseDeploymentLog
@using CID.Web.Support;

@{
    ViewBag.Title = "Deployment Log's Details";
}

<h2>Deployment Log's Details</h2>
<div id="Tabs">
    <ul>
        <li><a href="#GeneralPane">General</a></li>
        <li><a href="#DetailsPane">Details</a></li>
    </ul>
    <div id="GeneralPane">
        <div class="display-label">@Html.LabelFor(x => x.Release)</div>
        <div class="display-field">
            @Html.DisplayFor(x => x.Release.Name)
        </div>
        <div class="display-label">@Html.LabelFor(x => x.Environment)</div>
        <div class="display-field">
            @Html.DisplayFor(x => x.Environment.Name)
        </div>
        <div class="display-label">@Html.LabelFor(x => x.Status)</div>
        <div class="display-field">
            @Html.DisplayFor(x => x.Status)
        </div>
        <div class="display-label">@Html.LabelFor(x => x.StartTimestamp)</div>
        <div class="display-field">
            @Html.DisplayFor(x => x.StartTimestamp)
        </div>
        <div class="display-label">@Html.LabelFor(x => x.EndTimestamp)</div>
        <div class="display-field">
            @Html.DisplayFor(x => x.EndTimestamp)
        </div>
        <div class="display-label">@Html.LabelFor(x => x.Details)</div>
        <div class="display-field">
            @Html.TextAreaFor(x => x.Details, new { @readonly = true, rows=20, style="width:100%; max-width:100%;"  })
        </div>
    </div>
    <div id="DetailsPane">
        <div class="VersionDeploymentLogList">
            @foreach (var versionDeploymentLog in Model.Versions.OrderBy(x => x.Version.GetFullName()))
            {
                <h3><a href="#">@String.Format("{0} - {1}", versionDeploymentLog.Version.Component.Name, versionDeploymentLog.Version.Name)</a></h3>
                <div>
                    <div class="VersionDeploymentLogDetails">
                        <ul>
                            <li><a href="#@versionDeploymentLog.Id-Activation">Activation</a></li>
                            <li><a href="#@versionDeploymentLog.Id-Deactivation">Deactivation</a></li>
                            <li><a href="#@versionDeploymentLog.Id-Deployment">Deployment</a></li>
                        </ul>
                        <div id="@versionDeploymentLog.Id-Activation">
                            <div class="display-label">Activation Template</div>
                            <div class="display-field">
                                @Html.DisplayFor(x => versionDeploymentLog.ActivationTemplate.Name)
                            </div>
                            @foreach (var parameter in versionDeploymentLog.ActivationParameters.OrderBy(x => x.ParameterName))
	                        {
                                <div class="display-label">
                                    @Html.DisplayFor(x => parameter.ParameterName)
                                </div>
                                <div class="display-field">
                                    @Html.DisplayFor(x => parameter.ParameterValue)
                                </div>                        
	                        }
                        </div>
                        <div id="@versionDeploymentLog.Id-Deactivation">
                            <div class="display-label">Deactivation Template</div>
                            <div class="display-field">
                                @Html.DisplayFor(x => versionDeploymentLog.DeactivationTemplate.Name)
                            </div>
                            @foreach (var parameter in versionDeploymentLog.DeactivationParameters.OrderBy(x => x.ParameterName))
	                        {
                                <div class="display-label">
                                    @Html.DisplayFor(x => parameter.ParameterName)
                                </div>
                                <div class="display-field">
                                    @Html.DisplayFor(x => parameter.ParameterValue)
                                </div>                        
	                        }
                        </div>
                        <div id="@versionDeploymentLog.Id-Deployment">
                            <div class="display-label">Deployment Template</div>
                            <div class="display-field">
                                @Html.DisplayFor(x => versionDeploymentLog.DeploymentTemplate.Name)
                            </div>
                            @foreach (var parameter in versionDeploymentLog.DeploymentParameters.OrderBy(x => x.ParameterName))
	                        {
                                <div class="display-label">
                                    @Html.DisplayFor(x => parameter.ParameterName)
                                </div>
                                <div class="display-field">
                                    @Html.DisplayFor(x => parameter.ParameterValue)
                                </div>                        
	                        }
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#Tabs").tabs({
            select: function (event, ui) { setTimeout(function () { $('.VersionDeploymentLogList').accordion('resize'); }, 10) }
        });
        $(".VersionDeploymentLogList").accordion();
        $(".VersionDeploymentLogDetails").tabs({
            select: function (event, ui) { setTimeout(function () { $('.VersionDeploymentLogList').accordion('resize'); }, 10) }
        });
    });
</script>